
  class ListNode {
     int val;
     ListNode next;
     ListNode(int x) { val = x; }
 }

class Solution {
    public int kthToLast(ListNode head, int k) {
        ListNode node1 = head,node2 = head;
        while (k != 0) {
            node1 = node1.next;
            k--;
        }
        while (node1 != null) {
            node1 = node1.next;
            node2 = node2.next;
        }
        return node2.val;
    }
}